package com.stu.service.impl;

import com.stu.pojo.User;
import com.stu.service.UserService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    private List<User> users = new ArrayList<User>(){{
        add(new User("root","123","user","user:add"));
        add(new User("Bob","123456","user","user:select"));
    }};

    @Override
    public User getUserByName(String username) {
        for(User user:this.users){
            if(username.equals(user.getUsername())) return user;
        }
        return null;
    }
}
